1. Field of the Invention
The present invention relates generally to compression and decompression of small amounts of digitized image data used to represent, for example, an icon image. One implementation of the invention relates to compressing and decompressing an icon image having a color depth of 32 bits while retaining an accurate representation of the image.
2. Description of the Related Art
Digitized image data that is used in printers and scanners and displayed on monitors, for example, is typically quantized on a pixel-by-pixel basis and stored in available memory as a pixel map of image data. The pixel map is a two dimensional array of picture elements mapped to locations of the digitized image. In order to provide sufficient color range and fidelity, each pixel is typically stored in memory as a set of color coordinates which define a pixel""s color location in a given color space. For example, a pixel is typically represented by red, green and blue color component values (RGB values).
Due to the increased volume of data required to represent color images, much effort has been directed to the compression of data located in the color bitmaps. A compression technique in common use was developed by the Joint Photographic Experts Group (JPEG). JPEG is an international standards group which has developed a standard for the compression of continuous tone images. Compression using JPEG techniques can require the following: (1) a transformation from spacial information into frequency information via a discrete cosine transform, (2) a quantization routine which maps data to a compressed quantization matrix, and (3) compression of the quantized information by one of many data compression techniques.
However, data compression utilizing JPEG techniques cannot be efficiently applied to smaller images (e.g., smaller amounts of data) because it introduces error into the system and significantly reduces the space saving benefits normally associated with data compression. First, the JPEG quantization routine results in a loss of data due to the performance of rounding. Furthermore, known data compression techniques, such as those used in JPEG systems, are not able to efficiently compress smaller amounts of data. Most compression techniques are normally applied to large images of at least 256-by-256 pixels. These conventional compression techniques require fixed-size dictionaries which store required codes used during data compression/decompression. When fixed size dictionaries are used in large image compression tasks, the memory space utilized by the dictionaries is negligible compared to the amount of space saved. Unfortunately, utilizing these routines with smaller images (i.e., an icon image within a 32xc3x9732 pixel area) does not significantly reduce the amount of data stored because of the size of the dictionary required to perform the compression.
As such, there is a need for a data compression routine that is able to compress small amounts of image data without having to use a fixed size dictionary. Furthermore, there is a need for the data compression routine to increase the efficiency with which data is compressed.
The present invention is directed to a method and associated apparatus for compressing a small amount of image data while, at the same time, improving compression ratio and reducing the effects of lost data associated with data compression. In accordance with exemplary embodiments, such features are achieved through the use of a data compression algorithm which transforms image data from RGB color space to luminance and chrominance data values and also performs a run length encoding of transformed data streams.
More particularly, exemplary embodiments of the present invention transform RGB pixel data of an icon to a stream of luminance values and two individual streams indicating the chrominance of the image. The transformation to luminance values is performed to ensure that the luminance values, which provide brightness data vital to human perception, are not lost during data compression. Each luminance value is stored, and either a selected value out of four adjacent chrominance values or an average value of four adjacent chrominance values (for each stream) is stored. The transformation of the data provides a reduction in data of approximately 50%, relative to the amount of original RGB color space data, while retaining all luminance values. Once the luminance and chrominance values have been stored, run length encoding is applied to each data stream.
Exemplary embodiments of the present invention compress the luminance and chrominance values via run length encoding. The encoding algorithm determines if there are repetitions within each data stream. If data values are repeated, an operation code (opcode) related to the number of repetitions is generated and placed in the compressed data stream immediately before a repeated data value. If the data values are not repeated, an opcode is generated to indicate that the values following the opcode are not repeated. The opcode eliminates the repetition of redundant data values and therefore reduces the amount of data stored in memory.
By compressing icon images in accordance with exemplary embodiments of the present invention, improved data compression is realized without the need for a large fixed data dictionary, which would otherwise reduce the effects of the compression. Furthermore, in transforming from RGB values to luminance values, exemplary embodiments of the present invention achieve an improved mapping range.
Generally speaking, exemplary embodiments relate to a method and apparatus for processing data relating to an image by: receiving image data in RGB color space format; transforming RGB color space data values to luminance and chrominance data values; reducing the number of chrominance values by an averaging technique; encoding the transformed values to compress the image data; and storing the compressed data in a memory.